import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/index',
    children:[
      {
        path: "/index",
        component:()=>import('../views/client')
      },
      {
        path:'/bookList',
        component:()=>import('../views/client/bookList')
      },
      {
        path: '/order',
        component:()=>import('../views/client/order')
      },
      {
        path: '/order-detail',
        component:()=>import('../views/client/orderDetail')
      },
      {
        path: '/pay-success',
        component:()=>import('../views/client/paySuccess')
      },
      {
        path: '/cart',
        component:()=>import('../views/client/cart')
      },
      {
        path: '/bookDetail',
        component:()=>import('../views/client/bookDetail')
      }
    ]
  },
  {
    path: '/admin',
    component: ()=>import('../views/AdminHome'),
    redirect: '/admin-list',
    children: [
      {
        path: '/admin-list',
        component:()=>import('../views/admin/AdminList')
      },
      {
        path: "/admin-add-new",
        component:()=>import('../views/admin/CategoryAddNew')
      },
      {
      path: '/admin/category-list',
        component:()=>import('../views/admin/CategoryList')
      },
      {
        path: '/admin/banner-list',
        component:()=>import('../views/admin/BannerList')
      },
      {
        path: '/admin/banner-add-new',
        component:()=>import('../views/admin/BannerAddNew')
      },
      {
        path: '/admin/week-hot',
        component:()=>import('../views/admin/WeekHotList')
      },
      {
        path: '/admin/month-hot',
        component:()=>import('../views/admin/WeekHotList')
      },
      {
        path: '/admin/book-list',
        component:()=>import('../views/admin/BookList')
      },
      {
        path: '/admin/book-add-new',
        component:()=>import('../views/admin/BookAddNew')
      },
      {
        path: '/admin/order-list',
        component:()=>import('../views/admin/OrderList')
      },
      {
        path: '/admin/notice-list',
        component:()=>import('../views/admin/NoticeList')
      }
    ]
  },
  {
  path: '/login',
    component: ()=>import('../views/login')
  },{
  path: '/reg',
    component: ()=>import('../views/reg')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
